
public class Problem1 {
		
	public static void main(String[] args) {
		
		
		System.out.println(solve());
	}

	public static int solve() {		
		
		int[] factors = {3, 5};
		int n = 1000;
		int res = 0;
		
		cycle: for (int i=0; i<n; i++) {
			for (int j=0; j<factors.length; j++) {
				if (i % factors[j] == 0) {
					res += i;
					continue cycle;
				}
			}
		}
		
		return res;
	}
}
